<template>
  <!-- 记得加宽和高 -->
  <div ref="MyDiv" class="radar-echart"></div>
</template>

<script>
// 引入 echarts 核心模块，核心模块提供了 echarts 使用必须要的接口。
import * as echarts from 'echarts/core';

// 引入雷达图，图表后缀都为 Chart
import { RadarChart } from 'echarts/charts';

// 引入图例和标题组件,组件后缀都为 Component
import {
  TitleComponent,
  LegendComponent,
} from 'echarts/components';

// 引入 Canvas 渲染器，注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
import { CanvasRenderer } from 'echarts/renderers';

export default {
  name: 'radar',
  mounted() {
    echarts.use([TitleComponent, LegendComponent, RadarChart, CanvasRenderer]);
    let chartDom = this.$refs.MyDiv;
    let myChart = echarts.init(chartDom);
    let option;

  option = {
    title: {
      text: 'Basic Radar Chart'
    },
    legend: {
      data: ['李钊爱坤', '周全爱坤']
    },
    radar: {
      // shape: 'circle',
      indicator: [
        { name: '工作效率', max: 100 },
        { name: '考勤', max: 100 },
        { name: '积极性', max: 100 },
        { name: '帮助同事', max: 100 },
        { name: '自主学习', max: 100 },
        { name: '正确率', max: 100 }
      ]
    },
    series: [
      {
        name: '预算 vs 开销(Budget vs spending)',
        type: 'radar',
        data: [
          {
            value: [45, 30, 100, 20, 100, 45],
            name: '李钊爱坤'
          },
          {
            value: [50, 50, 50, 50, 50, 10],
            name: '周全爱坤'
          }
        ]
      }
    ]
  };
    option && myChart.setOption(option);
  }
}
</script>

<style scoped>
.radar-echart {
    width: 600px;
    height: 400px;
}
</style>